home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / asm32v20.zip / TEXT.DOC < prev   
Text File  |  1993-12-06  |  33KB  |  1,061 lines

  1.  
  2. ******************************  TEXT MODE  *******************************
  3.  
  4. ASM32 Text mode video subroutines (C) Copyright 1993 Douglas Herr
  5. All rights reserved
  6.  
  7. ASM32 subroutines write directly to the video memory buffer, except
  8. where noted.  ASM32 detects the default display type and screen
  9. dimensions.  ASM32 assumes that CGA equipment requires "snow" control
  10. and behaves accordingly.
  11.  
  12. EVGA32.LIB, provided with registration, does not include CGA "snow"
  13. control and is somewhat faster and more compact.  EVGA32.LIB will be
  14. best for most 32-bit PCs, but there are many 386SX and 386DX computers
  15. which were upgraded from 16-bit processors with a variety of video systems.
  16. For this reason ASM32 includes support for a variety of video systems.
  17.  
  18. Multiple pages of video memory are available except with MDA video adapters.
  19. Pages supported by ASM32 are shown below:
  20.  
  21. video system   screen size    ASM32 support    BIOS support
  22. -------------  -----------    --------------   ---------------
  23. MDA            80 x 25        page  0          page  0
  24. CGA, MCGA      80 x 25        pages 0 - 3      pages 0 - 3
  25. CGA, EGA, VGA  40 x 25        pages 0 - 7      pages 0 - 7
  26. EGA, VGA       80 x 25        pages 0 - 7      pages 0 - 7
  27. EGA            80 x 43        pages 0 - 3      pages 0 - 3
  28. VGA            80 x 50        pages 0 - 3      pages 0 - 3
  29. SEGA, SVGA    132 x 25        pages 0 - 3      pages 0 - 3
  30. SEGA, SVGA    132 x 43        pages 0 & 1      pages 0 & 1
  31. HGC, HGC+, InC 80 x 25        pages 0 - 15     page  0
  32. HGC+, InC      90 x 25        pages 0 - 13     page  0
  33. HGC+, InC      80 x 43        page  0          page  0
  34. HGC+, InC      90 x 43        page  0          page  0
  35.  
  36.    ASM32 subroutines assume that rows are the vertical dimension and
  37.    columns are the horizontal dimension of a text-mode screen.  The upper
  38.    left corner of the screen is at row=0 and col=0
  39.  
  40.  
  41. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  42.  
  43. ANSICOLOR:   determines color attribute used by ANSI device driver.
  44.              See also IsANSI.
  45. Source:      anscolor.asm
  46.  
  47. Call with:   no parameters
  48. Returns:     AH = color attribute
  49. Uses:        EAX
  50. Example:
  51.  
  52.         call  ansicolor         ; get ANSI screen color in AH
  53.  
  54.  
  55. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  56.  
  57. BLINK:       enable or disable blinking attriutes
  58.              disable or enable bright background attributes
  59. Source:      blink.asm
  60.  
  61. Call with:   AL = 1 for blinking attributes/no bright background attributes
  62.              AL = 0 for no blinking attributes/bright background attributes
  63. Returns:     nothing
  64. Uses:        nothing; all registers and flags are saved
  65. Supports:    All ASM32 text modes
  66. Example:
  67.  
  68. include codeseg.inc
  69.         .
  70.         .
  71.         .
  72.  
  73.         mov     al,0
  74.         call    blink            ; turn blinking attributes into bright
  75.                                  ; background attributes
  76.         .
  77.         .
  78.         .
  79.         mov     al,1
  80.         call    blink            ; turn bright background attributes into
  81.                                  ; blinking attributes
  82.  
  83.  
  84.  
  85. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  86.  
  87. CRTINFO:     central control for ASM32 Text subroutines; determines
  88.              active video system, screen size, page offset.
  89. Source:      crtinfo.asm
  90.  
  91. Call with:   AH = 0 for page 0 information
  92.              AH = -1 to calculate active page address
  93. Returns:     AL = screen rows
  94.              CH = screen columns
  95.              ES:[EBX] = video buffer address
  96.              DX = 3DAh if CGA, 0 if not CGA
  97.                DX is used to monitor screen retrace, to avoid "snow"
  98.                on older CGA systems.
  99. Uses:        ES, AX, EBX, CX, DX, flags
  100. Supports:    all ASM32 text modes
  101.  
  102.  
  103. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  104.  
  105. CURSORCOLOR: set cursor color and enable color palette (InColor only)
  106. Source:      curscolor.asm ($herc.asm)
  107.  
  108. Call with:   AH = color attribute (1 - 15)
  109. Returns:     if CF = 0, no error
  110.              if CF = 1, InColor card not installed
  111. Uses:        Carry Flag
  112. Supports:    Hercules InColor card only
  113. Example:
  114.  
  115. extrn   cursorcolor:proc
  116.  
  117. .code
  118.         .
  119.         .
  120.         .
  121.         mov   ah,14        ; bright yellow cursor
  122.         call  cursorcolor  ; enable InColor palette, set cursor color
  123.  
  124.  
  125.  
  126. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  127.  
  128. CURSOROFF:   make hardware cursor invisible at present location
  129. Source:      cursor.asm
  130.  
  131. Call with:   no parameters
  132. Returns:     nothing
  133. Uses:        nothing
  134. Supports:    CGA, MDA, HGC, HGC+, InC, EGA, VGA, SEGA, SVGA: text mode
  135. Example:     call  cursoroff
  136.  
  137.  
  138. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  139.  
  140. CURSORON:    move cursor to (row, col) and update cursor shape
  141.              Cursor shape is underscore if INSERT is off, larger block
  142.              if INSERT is on.  See also UCursorON.
  143. Source:      cursor.asm (crtinfo.asm)
  144.  
  145. Call with:   DH = row offset from top of screen
  146.              DL = column offset from left side
  147. Returns:     nothing
  148. Uses:        EAX
  149. Supports:    CGA, MCGA, MDA, HGC, HGC+, InC, EGA, SEGA, SVGA, VGA: text mode
  150. Example:     mov    dh,row        ; vertical coordinate on text screen
  151.              mov    dl,column     ; horizontal coordinate
  152.              call   cursoron
  153.  
  154.  
  155.  
  156. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  157.  
  158. GETSCREEN:   save a screen page to a memory buffer
  159. PUTSCREEN:   copy a saved screen page to the video buffer
  160. Source:      screen.asm (crtinfo.asm, $wcopy.asm)
  161.  
  162. Call with:   ESI pointing to memory buffer
  163. Returns:     nothing
  164. Uses:        nothing; all flags and registers are saved
  165. Supports:    All ASM32 text modes; includes CGA snow control
  166. Example:     see ScreenBytes for example
  167.  
  168.  
  169. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  170.  
  171. HSCROLL:     scroll a portion of the screen left or right.
  172. Source:      hscroll.asm ($wdata.asm, $wcopy.asm, a$putw.asm)
  173.  
  174. Call with:   EBX pointing to corner coordinates
  175.              AH = color attribute for cleared columns
  176.              ECX = number of columns to scroll
  177.                scrolls left if ECX > 0, scrolls right if ECX < 0
  178.                clears area if ECX = 0
  179. Returns:     nothing
  180. Uses:        nothing
  181. Supports:    All ASM32 text modes; includes CGA snow control
  182. Example:
  183.  
  184. include dataseg.inc
  185.  
  186. ; data
  187.  
  188. wdata        dw     10          ; row0
  189.              dw     10          ; column0
  190.              dw     20          ; row1
  191.              dw     40          ; column1
  192. @curseg   ends
  193.  
  194. include codeseg.inc
  195.  
  196. ; code
  197.  
  198.              .
  199.              .
  200.              .
  201.              lea    ebx,wdata   ; EBX points to window coordinates
  202.              mov    ah,color    ; AH = color attribute for cleared columns
  203.              mov    ecx,columns ; COLUMNS defined elsewhere
  204.              call   hscroll     ; to clear entire window, columns = 0
  205.  
  206.  
  207.  
  208. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  209.  
  210. PAINT:       change all color attributes on a text-mode screen
  211.              without re-printing the text
  212. Source:      paint.asm (crtinfo.asm, $paint.asm)
  213.  
  214. Call with:   AH = new color attribute
  215. Returns:     nothing
  216. Uses:        nothing
  217. Supports:    All ASM32 text modes; includes CGA snow control
  218. Example:     mov   ah,newcolor
  219.              call  paint
  220.  
  221.  
  222. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  223.  
  224. RECOLOR:     change selected color attributes on a text-mode screen
  225.              Replaces oldcolor attribute with newcolor, without
  226.              re-printing the text.
  227. Source:      recolor.asm (crtinfo.asm, $recolor.asm)
  228.  
  229. Call with:   AL = color to replace
  230.              AH = new color attribute
  231. Returns:     nothing
  232. Uses:        nothing
  233. Supports:    All ASM32 text modes; includes CGA snow control
  234. Example:     mov   al,oldcolor
  235.              mov   ah,newcolor
  236.              call  recolor
  237.  
  238.  
  239. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  240.  
  241. SCREENBYTES: calculate bytes required to save screen page
  242.              Used with GetScreen and PutScreen.
  243. Source:      scrbytes.asm (crtinfo.asm)
  244.  
  245. Call with:   no parameters
  246. Returns:     EAX = number of bytes required
  247. Uses:        EAX
  248. Example:
  249.  
  250. include model.inc
  251.  
  252. include dataseg.inc
  253.  
  254. saved_pointer dd ?
  255.  
  256. @curseg ends
  257.  
  258. include codeseg.inc
  259.  
  260.           .
  261.           .
  262.           .
  263.  
  264.         call  screenbytes
  265.         mov   ebx,eax
  266.         sys   GetMemNear
  267.         jc    drat               ; jump if error control needed
  268.         mov   saved_pointer,esi
  269.         call  getscreen          ; save the screen
  270.           .
  271.           .
  272.           .
  273.         mov   esi,saved_pointer
  274.         call  putscreen          ; restore the initial screen
  275.  
  276.  
  277. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  278.  
  279. SHOWTPAGE:   change video page shown on screen
  280. Source:      tpage.asm (crtinfo.asm, $herc.asm)
  281.  
  282. Call with:   BL = page number
  283. Returns:     AX = error code
  284.              0 = no error
  285.              -1 = bad page number
  286. Uses:        AX
  287. Supports:    All ASM32 text modes (except MDA equipment, some RamFont modes)
  288. Example:     mov    bl,1               ; show page 1
  289.              call   showtpage
  290.  
  291.  
  292.  
  293. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  294.  
  295. SNOWOFF:     disables CGA snow control
  296. SNOWON:      enables CGA snow control (ASM32 default)
  297. Source:      crtinfo.asm
  298.  
  299. Call with:   no parameters
  300. Returns:     nothing
  301. Uses:        no registers or flags
  302. Example:
  303.  
  304. extrn  snowoff:near
  305. extrn  getcrt:near
  306.  
  307. include codeseg.inc
  308.  
  309. ; code
  310.        .
  311.        .
  312.        .
  313.        call   getcrt
  314.        cmp    ax,2             ; ASM32 doesn't disable snow control
  315.                                ; on MCGA systems
  316.        jne    short continue
  317.        call   snowoff          ; MCGA doesn't need snow control
  318. continue:
  319.  
  320.  
  321.        
  322.  
  323. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  324.  
  325. STR2VBUF:    copies a string to video memory buffer, with selected
  326.              color attribute; includes snow control for CGA systems
  327. Source:      str2vbuf.asm
  328.  
  329. Call with:   ECX = maximum number of characters to print (will also stop
  330.                   at NUL character)
  331.              DX = 0 to disable snow control
  332.                 = 3DAh to enable CGA snow control
  333.                   (if DX = 3DAh on systems without a color monitor,
  334.                   the computer will jam up solid)
  335.              ESI points to first character of string
  336.              ES:[EDI] points to video buffer
  337.              AH = color attribute
  338.              DF = 0 (clear direction flag with CLD)
  339. Returns:     EDI points to video buffer following string
  340.              if AL = 0
  341.                 ESI points to byte following string's NUL terminator
  342.              if AL <> 0
  343.                 ESI points to next byte in string after the last one
  344.                 printed on the screen
  345. Uses:        AL, ECX, EDI, ESI, flags
  346.  
  347.  
  348.  
  349. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  350.  
  351. TCENTER:     prints a string on the screen, centered horizontally
  352. TNCENTER:    prints ECX bytes of a string on the screen, centered horizontally
  353. Source:      tcenter.asm (crtinfo.asm, str2vbuf.asm, strlen.asm)
  354.  
  355. Call with:   ESI pointing to the string
  356.              DH = row to print the string on
  357.              AH = color attribute
  358.              (tncenter only) ECX = number of bytes to print
  359. Returns:     nothing
  360. Uses:        nothing
  361. Supports:    all ASM32 text modes; includes CGA snow control
  362. Example:
  363.  
  364.      lea     esi,string  ; ESI points to the string
  365.      mov     dh,row
  366.      mov     ah,attr     ; color attribute
  367.      call    tcenter     ; center the string on row in DH
  368.  
  369.  
  370.  
  371. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  372.  
  373. TCLEAR:      clear a text-mode screen with specified color attribute
  374. Source:      tclear.asm (crtinfo.asm, a$putw.asm)
  375.  
  376. Call with:   AH = color attribute
  377. Returns:     nothing
  378. Uses:        AL
  379. Supports:    all ASM32 text modes; includes CGA snow control
  380. Example:     mov    ah,color
  381.              call   tclear
  382.  
  383.  
  384. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  385.  
  386. TCOPY:       copies one page of text-mode video memory to another page
  387. Source:      tcopy.asm (crtinfo.asm, tpage.asm, $herc.asm)
  388.  
  389. Call with:   BH = frompage, BL = topage
  390. Returns:     if CF = 0, all OK
  391.              if CF = 1 and AH = -1, frompage number is out-of-bounds
  392.              if CF = 1 and AL = -1, topage number is out-of-bounds
  393. Uses:        EAX, CF
  394. Supports:    all ASM32 text modes, pages 0 - 15; includes CGA snow control
  395. Example:     mov    bh,0               ; frompage
  396.              mov    bl,1               ; copy from page 0 to page 1
  397.              call   tcopy
  398.              jc     oops               ; oh yuck - an MDA
  399.  
  400.  
  401. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  402.  
  403. TFILL:       fill a text-mode screen with specified character and color
  404. Source:      tclear.asm (crtinfo.asm, a$putw.asm)
  405.  
  406. Call with:   AH = color attribute, AL = fill character
  407. Returns:     nothing
  408. Uses:        nothing
  409. Supports:    all ASM32 text modes; includes CGA snow control
  410. Example:
  411.              mov    ah,color
  412.              mov    al,char              ; AL = character to fill screen
  413.              call   tfill
  414.  
  415.  
  416.  
  417. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  418.  
  419. TGETCHR:     read character and attribute from text screen
  420. Source:      tgetchr.asm (crtinfo.asm)
  421.  
  422. Call with:   DH = screen row
  423.              DL = screen column
  424. Returns:     AH = color attribute
  425.              AL = ASCII character code
  426. Supports:    all ASM32 text modes; includes CGA snow control
  427. Example:
  428.  
  429.  
  430. extrn tgetchr:near
  431.  
  432. include dataseg.inc
  433.  
  434. ; data
  435.  
  436. position label word
  437. column   db 13
  438. row      db 18
  439.  
  440. @curseg   ends
  441.  
  442. include codeseg.inc
  443.  
  444. ; code
  445.          .
  446.          .
  447.          .
  448.          mov   dx,position
  449.          call  tgetchr         ; returns with AL = ASCII character code
  450.                                ;  and with AH = color attribute
  451.  
  452.  
  453.  
  454.  
  455. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  456.  
  457. TLOAD:       loads a screen image disk file saved by TSave
  458. Source:      tload.asm (crtinfo.asm)
  459.  
  460. Call with:   EDX = address of ASCIIZ filename in low memory
  461. Returns:     if CF = 1, AX = MS-DOS file I/O error code
  462.              if CF = 0, no error
  463. Uses:        EAX, CF
  464. Supports:    all ASM32 text modes; no CGA snow control
  465.              see also TSave
  466. Example:
  467.  
  468.  
  469. extrn   tload:proc
  470.  
  471. include dataseg.inc
  472.  
  473. ; data
  474.  
  475. filename  db 'tscreen.bin',0
  476.  
  477. @curseg   ends
  478.  
  479. include codeseg.inc
  480.  
  481. ; code
  482.      .
  483.      .
  484.      .
  485.      lea   edx,filename
  486.      call  tload
  487.  
  488.  
  489.  
  490.  
  491.  
  492. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  493.  
  494. TPAGE:       changes active page and shows new active page
  495. Source:      tpage.asm (crtinfo.asm, $herc.asm)
  496.  
  497. Call with:   BL = page number
  498.              for ASM32 subroutines writing directly to video memory.
  499.              See also UseTPage and ShowTPage.  ASM32's active page is
  500.              not affected by INT  10h mode changes.
  501.              Page -1 may be used on two-monitor systems, directs ASM32
  502.              video output to Monochrome screen (except cursor).
  503. Returns:     AX = error code
  504.              if AX = 0, no error
  505.              if AX = -1, bad page number
  506.              if AX = 1, page may be written to but cannot be shown
  507. Uses:        AX
  508. Supports:    text-mode screens, all row/column configurations
  509. Example:     mov    bl,page
  510.              call   tpage
  511.  
  512.  
  513. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  514.  
  515. TPRINT:      print ASCIIZ string directly to video buffer.
  516.              String must be terminated by a NUL character.  The string
  517.              may be in either low memory or high memory.
  518. Source:      tprint.asm (crtinfo.asm, str2vbuf.asm)
  519.  
  520. Call with:   ESI pointing to the string
  521.              DH = screen row, DL = screen column
  522.              AH = color attribute
  523. Returns:     ECX = bytes printed
  524. Uses:        ECX
  525. Supports:    all ASM32 text modes; includes CGA snow control
  526. Example:
  527.              lea     esi,string   ; ESI points to the string
  528.              mov     dh,row
  529.              mov     dl,column
  530.              mov     ah,attr      ; color attribute
  531.              call    tprint
  532.  
  533.  
  534.  
  535. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  536.  
  537. TPRINTCE:    prints an ASCIIZ string on the screen at specified position
  538.              and specified color, and clears from the end of the string
  539.              to the right edge of the screen.  The string may be in either
  540.              low memory or high memory.
  541. Source:      tprintce.asm (crtinfo.asm, str2vbuf.asm, a$putw.asm)
  542.  
  543. Call with:   ESI pointing to the string
  544.              DH = screen row, DL = screen column
  545.              AH = color attribute
  546. Returns:     ECX = bytes ptrinted
  547. Uses:        ECX
  548. Supports:    all ASM32 text modes; includes CGA snow control
  549. Example:
  550.              lea     esi,string   ; ESI points to the string
  551.              mov     dh,row
  552.              mov     dl,column
  553.              mov     ah,attr      ; color attribute
  554.              call    tprintce
  555.  
  556.  
  557. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  558.  
  559. TPRINTL:     print ASCIIZ string directly to video buffer, lower case
  560. Source:      tprintl.asm (crtinfo.asm)
  561.  
  562. TPRINTU:     print ASCIIZ string directly to video buffer, upper case
  563. Source:      tprintu.asm (crtinfo.asm)
  564.  
  565.              String must be terminated by a NUL character.  Similar to TPrint,
  566.              but characters a - z are TPrinted as upper case A - Z (TPrintU)
  567.              or characters A - Z are TPrinted as lower case a - z (TPrintL).
  568.              The string itself is not altered.
  569.  
  570. Call with:   ESI pointing to the string
  571.              DH = screen row, DL = screen column, AH = color attribute
  572.  
  573. Returns:     nothing
  574. Uses:        nothing
  575. Supports:    all ASM32 text modes; includes CGA snow control
  576. Example:
  577.  
  578.              lea     esi,string  ; ESI points to the string
  579.              mov     dh,row
  580.              mov     dl,column
  581.              mov     ah,attr     ; color attribute
  582.              call    tprintu
  583.  
  584. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  585.  
  586. TPUTCHR:     write character and attribute to screen
  587. Source:      tputchr.asm (crtinfo.asm)
  588.  
  589. Call with:   AL = ASCII character
  590.              AH = color attribute
  591.              DH = screen row
  592.              DL = screen column
  593. Returns:     nothing
  594. Uses:        nothing
  595. Supports:    all ASM32 text modes; includes CGA snow control
  596. Example:
  597.  
  598. extrn tputchr:near
  599.  
  600. include   dataseg.inc
  601.  
  602. ; data
  603.  
  604. position label word
  605. column   db 13
  606. row      db 18
  607. color    db 32              ; white on blue background
  608.  
  609. @curseg   ends
  610.  
  611. include   codeseg.inc
  612.  
  613. ; code
  614.          .
  615.          .
  616.          .
  617.          mov   dx,position
  618.          mov   ah,color
  619.          mov   al,'#'          ; character to write
  620.          call  tgetchr         ; returns with AL = ASCII character code
  621.                                ;  and with AH = color attribute
  622.  
  623.  
  624.  
  625. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  626.  
  627. TSAVE:       saves a screen image as a disk file; does not compress the image
  628. Source:      tsave.asm (crtinfo.asm)
  629.  
  630. Call with:   EDX = address of ASCIIZ filename in low memory
  631. Returns:     if CF = 1, AX = MS-DOS file I/O error code
  632.              if CF = 0, no error
  633. Uses:        E AX, CF
  634. Supports:    All ASM32 text modes; no CGA snow control
  635.              see also TLOAD
  636. Example:
  637.  
  638. extrn   tsave:proc
  639.  
  640. include dataseg.inc
  641.  
  642. ; data
  643.  
  644. filename  db 'tscreen.bin',0
  645.  
  646. @curseg   ends
  647.  
  648. include codeseg.inc
  649.  
  650. ; code
  651.      .
  652.      .
  653.      .
  654.      lea   edx,filename
  655.      call  tsave
  656.  
  657.  
  658. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  659.  
  660. UCURSORON:   similar to CursorON, but the underscore cursor is used regardles
  661.              of the state of the INSERT toggle.  See also CursorON.
  662. Source:      cursor.asm (crtinfo.asm)
  663.  
  664. Call with:   DH = row offset from top of screen
  665.              DL = column offset from left side
  666. Returns:     nothing
  667. Uses:        AX
  668. Supports:    text mode, all pages, all row/column configurations
  669. Example:     mov    dh,row
  670.              mov    dl,col
  671.              call   ucursoron
  672.  
  673.  
  674. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  675.  
  676. USETPAGE:    establish ASM32's active page
  677. Source:      tpage.asm (crtinfo.asm, $herc.asm)
  678.  
  679. Call with:   BL = page number
  680.              ASM32 text-mode subroutines can be directed to any video
  681.              page.  ASM32's active page is not affected by INT  10h
  682.              mode changes.  UseTPage does not change the page shown
  683.              on the screen.  See also TPage and ShowTPage.
  684.              If newpage = -1, ASM32 video output is directed to a
  685.              Monochrome screen
  686. Returns:     AX = error code
  687.              if AX = -1, bad page number
  688. Uses:        AX, ES
  689. Supports:    All ASM32 text modes
  690. Example:     mov     bl,page
  691.              call    usetpage
  692.  
  693.  
  694.  
  695. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  696.  
  697. VSCROLL:     scroll a portion of the screen up or down.
  698. Source:      vscroll.asm ($wdata.asm, $wcopy.asm, a$putw.asm)
  699.  
  700. Call with:   EBX pointing to corners of scroll area
  701.              AH = color attribute, ECX = number of rows to scroll
  702.              Scrolls up if ECX > 0, scrolls down if ECX < 0, clears area
  703.              if ECX = 0
  704. Returns:     nothing
  705. Uses:        nothing
  706. Supports:    all ASM32 text modes; includes CGA snow control
  707. Example:
  708.  
  709. include dataseg.inc
  710.  
  711. ; data
  712.  
  713. wdata        dw     10               ; row0
  714.              dw     10               ; column0
  715.                                      ; (row0, column0) = upper left corner
  716.              dw     20               ; row1
  717.              dw     40               ; column1
  718.                                      ; (row1, column1) = lower right corner
  719. @curseg   ends
  720.  
  721. include codeseg.inc
  722.  
  723. ; code
  724.              .
  725.              .
  726.              .
  727.              lea    ebx,wdata        ; EBX points to window coordinates
  728.              mov    ah,color
  729.              mov    ecx,3            ; scroll up 3 rows
  730.              call   vscroll
  731.  
  732.  
  733. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  734.  
  735. WCLEAR:      clear a rectangular portion of a text-mode screen
  736. Source:      wclear.asm ($wdata.asm, crtinfo.asm, a$putw.asm)
  737.  
  738. Call with:   EBX pointing to box corner data
  739.              AH = color attribute
  740. Returns:     nothing
  741. Uses:        AL, flags
  742. Supports:    all ASM32 text modes; includes CGA snow control
  743. Example:
  744.  
  745. include dataseg.inc
  746.  
  747. ; data
  748.  
  749. wdata        dw     10               ; row0
  750.              dw     10               ; column0
  751.              dw     20               ; row1
  752.              dw     40               ; column1
  753.  
  754. @curseg   ends
  755.  
  756. include codeseg.inc
  757.  
  758. ; code
  759.              .
  760.              .
  761.              .
  762.              lea    ebx,wdata        ; EBX points to window coordinates
  763.              mov    ah,color
  764.              call   wclear           ; clear a box on the screen with corners
  765.                                      ; at (row0, column0), (row1, column0),
  766.                                      ; (row0, column1) and (row1, column1)
  767.  
  768.  
  769.  
  770.  
  771. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  772.  
  773. WFILL:       fill a rectangular protion of a text-mode screen with
  774.              specified character and attribute; variation of WClear
  775. Source:      wclear.asm ($wdata.asm, crtinfo.asm, a$putw.asm)
  776.  
  777. Call with:   EBX pointing to box corner data
  778.              AH = color attribute
  779.              AL = fill character
  780. Returns:     nothing
  781. Uses:        flags
  782. Supports:    all ASM32 text modes; includes CGA snow control
  783. Example:
  784.  
  785. include dataseg.inc
  786.  
  787. ; data
  788.  
  789. wdata        dw     10               ; row0:    top of fill area
  790.              dw     10               ; column0: left side of fill area
  791.              dw     20               ; row1:    last row of fill area
  792.              dw     40               ; column1: right side of fill area
  793.  
  794. @curseg   ends
  795.  
  796. include codeseg.inc
  797.  
  798. ; code
  799.              .
  800.              .
  801.              .
  802.              lea    ebx,wdata        ; EBX points to window coordinates
  803.              mov    ah,color
  804.              mov    al,'■'           ; use ASCII 254 to fill
  805.              call   wfill            ; fill a box on the screen with corners
  806.                                      ; at (row0, column0), (row1, column0),
  807.                                      ; (row0, column1) and (row1, column1)
  808.  
  809.  
  810.  
  811. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  812.  
  813. WFRAME:      draw a box on a text-mode screen
  814. Source:      wframe.asm (a$wdata.asm, a$putw.asm, crtinfo.asm)
  815.  
  816. Call with:   EBX pointing to box corner data
  817.              AH = color attribute
  818.              AL = box character
  819.              box character is the character associated with an ASCII code
  820.              if AL = 0, a single line is used
  821.              if AL = -1, a double line is drawn
  822. Returns:     nothing
  823. Uses:        nothing
  824. Supports:    all ASM32 text modes; includes CGA snow control
  825. Example:
  826.  
  827. include dataseg.inc
  828.  
  829. ; data
  830.  
  831. wdata        dw     10               ; row0
  832.              dw     10               ; column0
  833.              dw     20               ; row1
  834.              dw     40               ; column1
  835.  
  836. @curseg   ends
  837.  
  838. include codeseg.inc
  839.  
  840. ; code
  841.              .
  842.              .
  843.              .
  844.              lea    ebx,wdata        ; EBX points to window coordinates
  845.              mov    ah,color
  846.              mov    al,'■'           ; use ASCII 254 for boundary
  847.              call   wframe           ; draw a box on the screen with corners
  848.                                      ; at (row0, column0), (row1, column0),
  849.                                      ; (row0, column1) and (row1, column1)
  850.  
  851.  
  852.  
  853. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  854.  
  855. WSIZE:       calculate the memory required to save a screen window
  856. Source:      wsize.asm
  857.  
  858. Call with:   EBX pointing to row & column coordinates
  859.              The row and column coordinates define the corners of the
  860.              window.
  861. Returns:     EAX = bytes required
  862. Uses:        EAX
  863. Supports:    All ASM32 text modes
  864. Example:     
  865.  
  866. include dataseg.inc
  867.  
  868. ; data
  869.  
  870. wdata        dw     10               ; row0
  871.              dw     10               ; column0
  872.              dw     20               ; row1
  873.              dw     40               ; column1
  874.  
  875. @curseg   ends
  876.  
  877. include codeseg.inc
  878.  
  879. ; code
  880.  
  881.              .
  882.              .
  883.              .
  884.              lea    ebx,wdata        ; EBX points to window coordinates
  885.              call   wsize            ; returns EAX = bytes required
  886.              mov    ebx,eax
  887.              sys    GetMemNear
  888.              jc     oh_no            ; big problem if no space!
  889.  
  890.  
  891.  
  892. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  893.  
  894. WPAINT:      replace all color attributes in a window of the screen
  895. Source:      wpaint.asm ($wdata.asm, crtinfo.asm, $paint.asm)
  896.  
  897. Call with:   EBX pointing to window coordinates
  898.              AH = new color attribute
  899. Returns:     nothing
  900. Uses:        nothing; all registers and flags are saved
  901. Supports:    all ASM32 text modes; includes CGA snow control
  902. Example:
  903.  
  904. include dataseg.inc
  905.  
  906. ; data
  907.  
  908. wdata        dw     10               ; row0
  909.              dw     10               ; column0
  910.              dw     20               ; row1
  911.              dw     40               ; column1
  912.  
  913. @curseg   ends
  914.  
  915. include codeseg.inc
  916.  
  917. ; code
  918.  
  919.              .
  920.              .
  921.              .
  922.              lea    ebx,wdata        ; EBX points to window coordinates
  923.              mov    ah,color         ; AH = new color attribute
  924.              call   wpaint
  925.  
  926.  
  927.  
  928. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  929.  
  930. WPRINT:      print ASCIIZ string directly to the video buffer in a
  931.              window of screen, with word wrap.  String must be terminated
  932.              by a NUL character.  WPrint clears any portion of the window
  933.              not occupied by the string.
  934. Source:      WPRINT.ASM (crtinfo.asm, str2vbuf.asm, strlen.asm, $wdata.asm,
  935.                          a$putw.asm)
  936.  
  937. Call with:   ESI pointing to the string
  938.              EBX pointing to window corners
  939.              AH = color attribute
  940. Returns:     nothing
  941. Uses:        nothing
  942. Supports:    all ASM32 text modes; includes CGA snow control
  943. Example:
  944.  
  945. extrn   wframe:proc, wprint:proc
  946.  
  947. include dataseg.inc
  948.  
  949. ; data
  950. wdata   dw 10,10,20,30          ; window corner data: upper left at row 10,
  951.                                 ; column 10; lower right at row 20, column 30
  952. string  db "The quick brown fox jumped over the lazy dog's back",0
  953.  
  954. @curseg   ends
  955.  
  956. include codeseg.inc
  957.  
  958. ; code
  959.      .
  960.      .
  961.      .
  962.      lea     esi,string   ; ESI points to the string
  963.      lea     ebx,wdata    ; EBX points to corner data
  964.      mov     ah,12        ; bright red!!
  965.      call    wprint
  966.  
  967.      dec     wdata        ; stretch the window borders a bit
  968.      dec     wdata+2      ; so I can draw a frame around the silly text
  969.      inc     wdata+4
  970.      inc     wdata+6
  971.      mov     al,-1        ; double-line border
  972.      mov     ah,14        ; bright yellow
  973.      call    wframe
  974.  
  975.  
  976. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  977.  
  978. WRECOLOR:    change selected color attributes in a window of the screen
  979. Source:      wrecolor.asm ($wdata.asm, crtinfo.asm, $recolor.asm)
  980.  
  981. Call with:   EBX pointing to window corner data
  982.              AL = color attribute to be replaced
  983.              AH = new color attribute
  984. Returns:     nothing
  985. Uses:        nothing; all registers and flags are saved
  986. Supports:    all ASM32 text modes; includes CGA snow control
  987. Example:
  988.  
  989. include dataseg.inc
  990.  
  991. ; data
  992.  
  993. wdata        dw     10               ; row0
  994.              dw     10               ; column0
  995.              dw     20               ; row1
  996.              dw     40               ; column1
  997.  
  998. @curseg   ends
  999.  
  1000. include codeseg.inc
  1001.  
  1002. ; code
  1003.  
  1004.              .
  1005.              .
  1006.              .
  1007.              lea    ebx,wdata        ; EBX points to window coordinates
  1008.              mov    ah,newcolor      ; AH = new color attribute
  1009.              mov    al,oldcolor      ; AL = color to be replaced
  1010.              call   wrecolor         ; replace oldcolor with newcolor
  1011.                                      ; within the window
  1012.  
  1013.  
  1014. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1015.  
  1016. WRESTORE:    restore a portion of a text-mode screen from a buffer
  1017. WSAVE:       save a portion of a text-mode screen to a buffer
  1018.              (handy when using pop-up windows on the screen)
  1019. Source:      wsave.asm ($wdata.asm, crtinfo.asm, $wcopy.asm)
  1020.  
  1021. Call with:   EDI pointing to memory buffer
  1022.              EBX pointing to corner data
  1023.              The memory buffer must be sized to hold the entire window.
  1024.              See wsize.
  1025. Returns:     nothing
  1026. Uses:        nothing
  1027. Supports:    all ASM32 text modes; includes CGA snow control
  1028. Example:
  1029.  
  1030. include dataseg.inc
  1031.  
  1032. ; data
  1033.  
  1034. wdata   dw 10               ; row0
  1035.         dw 10               ; column0
  1036.         dw 20               ; row1
  1037.         dw 40               ; column1
  1038. buffer  dw 2000h            ; oversize
  1039.  
  1040. @curseg   ends
  1041.  
  1042. include codeseg.inc
  1043.  
  1044. ; code
  1045.  
  1046.         .
  1047.         .
  1048.         .
  1049. ; save a part of the screen
  1050.         lea    ebx,wdata        ; EBX points to window coordinates
  1051.         lea    edi,buffer       ; point to buffer
  1052.         call   wsave
  1053.         .
  1054.         .
  1055.         .
  1056. ; sometime later ...
  1057. ; restore the window saved earlier
  1058.         lea    ebx,wdata        ; EBX points to window coordinates
  1059.         lea    edi,buffer       ; point to buffer
  1060.         call   wrestore
  1061.